<?php
error_reporting(7);
require "common.php";
$action=$_GET["action"];
if($action=="checkwx_isexsit"){//判断微信是否已经提交过,防止重复提交
    require "tools/class.submit.php";
    $wx_num=$_GET["wx_num"];
    $submit=new SUBMIT($DB);
    
    $isexsit=$submit->checkisexsit($wx_num);
    if($isexsit){
        $result=array("result"=>-1,msg=>"该微信号已经提交过！");
    }else{
        $result=array("result"=>0,msg=>"该微信号可以提交");
    }
}
if($action=="wx_add"){

    require "tools/class.submit.php";

    /*$wx_title=$_POST["wx_title"];
    $p=$_POST["Province"];
    $c=$_POST["City"];
    $a=$_POST["Area"];
    $keyword=$_POST["keyword"];
    $short_contents=$_POST["short_contents"];
    $contents=$_POST["contents"];
    $wx_default_num=$_POST["wx_default_num"];
    $wx_num=$_POST["wx_num"];
    $contact=$_POST["contact"];
    $tel=$_POST["tel"];
    $qq=$_POST["qq"];
    $email=$_POST["email"];
    $web_url=$_POST["web_url"];
    $t_url=$_POST["t_url"];*/
    $_POST["head_url"]=$_POST["head_url_result"];
    $_POST["code_url"]=$_POST["code_url_result"];
    unset($_POST["head_url_result"]);
    unset($_POST["code_url_result"]);
    $wx_submit=new SUBMIT($DB);

    $result=$wx_submit->request_submit($_POST);
    print_r($result);
    if($result===-2){
        die("<script>alert('微信原始号已经存在请不要重复提交');history.back();</script>");
    }elseif($result===-1){
        die("<script>alert('微信号已经存在请不要重复提交');history.back();</script>");
    }elseif($result===0){
        die("<script>alert('提交失败');history.back();</script>");
    }else{
        die("<script>alert('提交成功');location.href='index.php';</script>");
    }
}
die(json_encode($result));